Remove overzealous validity check for secrets
authorAndre Heinecke <aheinecke@intevation.de>
Mon, 24 Nov 2014 09:59:32 +0000 (10:59 +0100)
committerMatthias Clasen <mclasen@redhat.com>
Wed, 26 Nov 2014 03:51:45 +0000 (22:51 -0500)
   We directly get the length of the secret from the g_variant
   and use it in a following g_strndup which ensures that the
   resulting string is terminated.

   This fixes reading secrets which were stored by system-config-printer.

https://bugzilla.gnome.org/show_bug.cgi?id=740612

modules/printbackends/cups/gtkcupssecretsutils.c

index 895e4bbcdb8ebcec9cfa40d66d900d832b4bab7e..7c5f374491969261f9527f9fd16a3fc090c9e72f 100644 (file)
@@ -200,10 +200,9 @@ get_secret_cb (GObject      *source_object,
 
       g_variant_unref (secret);
 
-      if (ba_passwd == NULL || strlen (ba_passwd) > len + 1)
+      if (ba_passwd == NULL)
         {
-          /* No secret or the secret is not a zero terminated value */
-          GTK_NOTE (PRINTING, g_print ("Invalid secret.\n"));
+          GTK_NOTE (PRINTING, g_print ("Invalid / no secret found.\n"));
           g_variant_unref (s_value);
           goto fail;
         }